<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
  <title>station</title>
</head>
<body>
<style>
  #box{
    padding-top: 20%;
    text-align: center;
  }

  #box img{
    width: 300px;
    margin-bottom: -70px;
  }

  #message{
    color: #333;
    font-size: 16px;
  }
</style>
<div id="box">
  <img src="" alt="请稍候~">
  <p id="message"></p>
</div>

<script type="text/javascript">
  function $(s) {
	return document.querySelector(s);
  }

  function ranger(min, max) {
    return Math.floor(Math.random()*(max-min+1)+min);
  }

  var message = $('#message');

  function count(time, callback) {
	message.innerText = '当前人数太多，请耐心等待（' + (time--) + 's）';
	var timer = setInterval(function () {
	  if (time <= 0) {
		clearInterval(timer);
		callback && callback();
		return;
	  }
	  message.innerText = '当前人数太多，请耐心等待（' + (time--) + 's）';
	}, 1000);
  }

  count(ranger(5, 15), function () {
    console.log('time over', document.referrer)
    location.href = document.referrer
  })

</script>

</body>
</html>
